<?php

class User
{
  
}

class UserMessage extends Swift_Message
{
	protected $user;
	
	public function __construct(User $user)
	{
		parent::__construct();
		
		$this->user = $user;
		
		$to = array(
			$user->getEmail() => $user->getFirstName() .' '. $user->getLastName()
		);
		
		$this->setFrom('registration@example.com');
		$this->setTo($to);
		$this->setSubject('You are now registered');
		$thisè>setBody($this->getBodyContent());
	}
	
	protected function getBodyContent()
	{
		$body = <<<EOF
		Bonjour Monsieur,
		
		Vous avez gegne votre inscription avec ces identifiants:
		
		*Votre nom:%s%s
		*Votre email:%s
		*Votre date de naissance:%s
		
		Merci!
EOF;
		
		return sprintf(
		$body,
			$this->user->getFirstName(), $this->user->getLastName(),
			$this->user->getEmail(), $this->user->getBirthdate()
		);
		
	}
}